import request from '@/utils/request'

// 查询维修单列表
export function listRepairOrder(query) {
  return request({
    url: '/ldzl-sb/sb/repair/order/findAll',
    method: 'get',
    params: query
  })
}

// 查询维修单详细
export function getRepairOrder(id) {
  return request({
    url: '/ldzl-sb/sb/repair/order/findById',
    method: 'get',
    params: { order_id: id }
  })
}

// 修改维修单
export function updateRepairOrder(data) {
  return request({
    url: '/ldzl-sb/sb/repair/order/update',
    method: 'post',
    data: data
  })
}

// 处理维修单（开始处理）
export function processRepair(data) {
  return request({
    url: '/ldzl-sb/sb/repair/order/handle',
    method: 'post',
    data: data
  })
}

// 完成维修
export function completeRepair(data) {
  return request({
    url: '/ldzl-sb/sb/repair/order/complete',
    method: 'post',
    data: data
  })
}

// 取消维修
export function cancelRepair(id, reason) {
  return request({
    url: '/ldzl-sb/sb/repair/order/cancel',
    method: 'get',
    params: { 
      order_id: id,
      cancel_reason: reason 
    }
  })
}

// 获取可用设备
export function getAvailableEquipments() {
  return request({
    url: '/ldzl-sb/sb/repair/order/equipment/list',
    method: 'get'
  })
}

// 获取设备列表
export function getEquipmentList() {
  return request({
    url: '/ldzl-sb/sb/equipment/list',
    method: 'get'
  })
} 